//
//  OPNSStringAdditions.m
//  OPFramework
//
//  Created by malcom on 7/18/08.
//  Copyright 2008 malcom-mac software. All rights reserved.
//

#import "OPNSStringAdditions.h"


@implementation NSString (OPNSStringAdditions)

#define imgTagStart @"<img src=\""

- (NSString *) returnImageURLFromHTMLImageTagOfBoard:(OPBoard *) _board {
	NSRange stLoc = [self rangeOfString: @"/" options: NSCaseInsensitiveSearch 
								  range: NSMakeRange([imgTagStart length],[self length]-[imgTagStart length])];
	NSRange endLoc = [self rangeOfString: @"\"" options: NSCaseInsensitiveSearch 
								   range: NSMakeRange(stLoc.location,[self length]-stLoc.location)];
	if (endLoc.location != NSNotFound)
		return [NSString stringWithFormat: @"%@%@",_board.obj_boardRootPath,[self substringWithRange: NSMakeRange(stLoc.location,endLoc.location-stLoc.location)]];
	return nil;
}

@end
